<?php
session_start();
require "../../../global.php";//$dirname."/".
require $dirname."/"."inc/config.php";
require $dirname."/"."inc/Uifunction.php";

require $dirname."/".$guanliDir."/UIFunction/adminClass.php";
require $dirname."/".$guanliDir."/System/Config.php";
require $dirname."/".$guanliDir."/System/MenuSys/function.php";
require $dirname."/".$guanliDir."/System/ClassSys/function.php";
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>保存修改</title>
<link href="../../../Inc/Css.css" rel="stylesheet" type="text/css">
</head>
<body>
<?
$myClass=new ADMINClass();
$myClass->loginCheck();//验证管理员是否登陆
$myClass->guanliDir=$guanliDir;
$myClass->loginAdminCheck($chaojizhanghao);//验证超级管理员登陆
	

$MenuId=$_REQUEST["MenuId"];
$ID=$_REQUEST["ID"];

$mydb=new YYBDB();
$TableName=reTableName($mydb,$MenuId);

if(strlen($MenuId)<1)
{
	$MenuId=-1;
}

echo CurrPosition((int)($MenuId),$mydb);

//权限控制
if(GetUpdateRule(GetUserMenuRuleValue($MenuId,$mydb,$_SESSION["Login"][0]))==false  and $_SESSION["Login"][1]<>$chaojizhanghao)
{ 
	
	$myClass->smPicPath="../../Iamges/Error.jpg";
	$myClass->smMsg="您没有操作权限！";
	$myClass->smURL="/".$guanliDir."/System/".$TableName."/Index.php?MenuId=".$MenuId;
	$myClass->MessgBox();
	die;
}

$FieldCount=GetTableFieldCount($mydb,$TableName);

$myFields=array();


for($i=1;$i<$FieldCount;$i++)
{
	if($_REQUEST["FieldName_".$i]!="")
	{
		echo $_REQUEST["FieldName_$i_Min"]."-----$i"."<br>";
		if($_REQUEST["FieldName_$i_Min"]!="")
		{
			$myFields[$i]=$_REQUEST["FieldName_$i_Min"];
		}
		else
		{
			$myFields[$i]=$_REQUEST["FieldName_$i"];
		}
	}
	else
	{
		$myFields[$i]="";
	}
}
foreach($myFields as $k1)
{
	echo $k1."<br>";
}
die;
$myFields[0]=$ID;
$mydb->TableName=$TableName;
$mydb->ArrFields=$myFields;
$mydb->Update();
	
	$myClass=new ADMINClass();
	$myClass->smPicPath=$dirname."/".$guanliDir."/Iamges/Right.jpg";
	$myClass->smMsg="操作成功！";
	$myClass->smURL="/".$guanliDir."/System/".$TableName."/Index.php?MenuId=$MenuId&PMID=". $_REQUEST["PMID"]."&CurrPage=" .$_REQUEST["CurrPage"]."";
	$myClass->MessgBox();


?>


</body>
</html>
